/*
 * @Author: silence
 * @Date: 2023-08-02 09:52:46
 * @LastEditors: 
 * @LastEditTime: 2023-12-27 10:58:17
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:mybase/base/abstract/IFFScaffold.dart';
import 'package:mybase/base/config/ColorConfig.dart';
import 'package:mybase/base/tool/arouter/FFGoto.dart';
import 'package:webview_window_example/pages/appin/AppInTranslatePage.dart';
import 'package:webview_window_example/MainPage.dart';

final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

void main(List<String> args) {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<MainEntity> list = [
    MainEntity(
        title: "flutter项目内翻译",
        onClick: () {
          FFGoto.gotoPage(navigatorKey.currentContext!, AppInTranslatePage());
        }),
  ];

  @override
  void initState() {
    ColorConfig().bodyColor = Colors.white;
    ColorConfig().statusBackgroundColor = Colors.black;
    ColorConfig().statusTextColor = SystemUiOverlayStyle.light;
    ColorConfig().splashColor = Colors.green;
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorObservers: [routeObserver],
      navigatorKey: navigatorKey,
      builder: FlutterSmartDialog.init(),
      home: MainPage(),
      onGenerateTitle: (ctx) {
        return "自动翻译";
      },
    );
  }
}

class MainEntity {
  String title;
  Function() onClick;

  MainEntity({
    required this.title,
    required this.onClick,
  });
}
